<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;

$this->title = '角色授权';
$this->params['breadcrumbs'][] = '管理员设置';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="nav-tabs-custom">

    <div class="box">
        <div class="box-body">
            <?php $form = ActiveForm::begin(); ?>
            <table class="table table-striped table-advance table-hover">
                <thead>
                <tr>
                    <th class="tablehead" colspan="2"><?=$this->title.': '.$role;?></th>
                </tr>
                </thead>
                <tbody>



                <?php foreach ($treeArr as $tree): ?>
                    <tr>
                        <td><label><?=$tree['name']?></label></td>
                    </tr>
                    <tr>
                        <td>
                    <?php if (!empty($tree['_child'])): ?>
                        <?php foreach ($tree['_child'] as $childs): ?>
                            <?php if ($childs['pid'] == $tree['id']): ?>
                                <label style="padding-left: 40px;"><input type="checkbox" name="rules[]" value="admin/<?=$childs['url']?>" <?php if(in_array('admin/'.$childs['url'], $authRules)) { echo 'checked'; }?>> <?=$childs['name']?></label>
                            <?php endif; ?>
                        <?php endforeach; ?>
                    <?php endif; ?>
                        </td>
                    </tr>
                <?php endforeach; ?>
                </tbody>
            </table>
            <div class="form-group">
                <?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
            </div>
            <?php ActiveForm::end(); ?>

        </div>
    </div>
</div>
<?php $this->render('@app/modules/admin//views/layouts/modal-form', ['form'=>$form])?>